﻿using Hidistro.Core;
using JSShop.Model;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hidistro.UI.SaleSystem.Tags
{
    public class wnxd_DetailPagesLocation : WebControl
    {
        public wnxd_DetailPagesLocation()
        {
            base.ID = "wnxd_DetailPagesLocation";
        }
        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(this.RendHtml());
        }
        public string RendHtml()
        {
            StringBuilder builder = new StringBuilder();
            if (!string.IsNullOrEmpty(this.CateGoryPath))
            {
                builder.Append("<p>当前位置：<a class=\"dqym\" href=\"/\">橘色商城</a>");
                foreach (string str in this.CateGoryPath.Split('|'))
                {
                    Hishop_Categories category = new Juse.Interface.CategoryBrowser().GetCategoryInfo(int.Parse(str));
                    if (category != null)
                    {
                        builder.AppendFormat(" > <a href =\"{0}\">{1}</a>", Globals.GetSiteUrls().StaticizeSubCategory(category.CategoryId, category.RewriteName,(int)category.ParentCategoryId, category.ParentRewriteName,0,0,0,0,0), category.Name);
                    }
                }
                if (!string.IsNullOrEmpty(this.ProductName))
                {
                    builder.AppendFormat("<span>{0}</span>", this.ProductName);
                }
                builder.Append("</p>");
            }
            return builder.ToString();
        }
        public string CateGoryPath { get; set; }
        public string ProductName { get; set; }
    }
}